package com.grad.webstudy.utils;

import java.util.Base64;

/**
 * @Author: zjf
 * @Date: 2020/1/20 21:38
 * @Description:
 */
public class Base64Utils {

    public static String encode(String origin){
        return Base64.getEncoder().encodeToString(origin.getBytes());
    }

    public static String decode(String decode){
        return new String(Base64.getDecoder().decode(decode));
    }

    public static void main(String[] args) {
        System.out.println("testin");
        System.out.println(encode("testin"));
        System.out.println(decode(encode("testin")));
    }
}
